#!/sbin/sh
# Script for checking prerequisites for OpenSIPS-berkeley

BASE="OpenSIPS-base"
LIBBDB="libdb-4.7.so"
TMPLIST="/tmp/.opensipsbdb"

pkginfo | grep -i $BASE > /dev/null

if [ $? -eq 1 ]
then
	echo "OpenSIPS-berkeley depends on package OpenSIPS-base which is not installed";
	exit 1;
fi

find / -name $LIBBDB > $TMPLIST 2>&1
lines=`wc -l $TMPLIST`

if [ $lines = "0" ]
then
	echo "OpenSIPS-berkeley depends on DB Berkeley Libraries, which cannot be found on system";
	exit 1;
else
	exit 0;
fi
